#!/usr/bin python3
# -*- coding: utf-8 -*-
from typing import List


class mclass:
    def __init__(self, n: int, ab: List[list]):
        self._n = n
        self._ab = ab

    def _analysis(self, i: int):
        k = self._ab[i-1]
        return k[0] * (i -1) + k[1] * (self._n - i)

    def sum(self):
        temp = []
        for i in range(1, self._n + 1):
            temp.append(self._analysis(i))

        return sum(temp)


if __name__ == '__main__':
    n = int(input())
    ab = []
    for _ in range(n):
        ab.append([int(i) for i in input().split(' ')])
    m = mclass(n, ab)
    res = m.sum()
    print(3)
